package com.ruoyi.recruit.service.impl;

import java.util.Arrays;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.recruit.domain.RecruitInfo;
import com.ruoyi.recruit.mapper.RecruitInfoMapper;
import com.ruoyi.recruit.service.IRecruitInfoService;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.text.Convert;

/**
 * 招聘信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-01-17
 */
@Service
public class RecruitInfoServiceImpl extends ServiceImpl<RecruitInfoMapper, RecruitInfo> implements IRecruitInfoService
{

    /**
     * 查询招聘信息
     * 
     * @param recruitId 招聘信息主键
     * @return 招聘信息
     */
    @Override
    public RecruitInfo selectRecruitInfoByRecruitId(Long recruitId)
    {
        return baseMapper.selectRecruitInfoByRecruitId(recruitId);
    }

    /**
     * 查询招聘信息列表
     * 
     * @param recruitInfo 招聘信息
     * @return 招聘信息
     */
    @Override
    public List<RecruitInfo> selectRecruitInfoList(RecruitInfo recruitInfo)
    {
        return baseMapper.selectRecruitInfoList(recruitInfo);
    }

    /**
     * 新增招聘信息
     * 
     * @param recruitInfo 招聘信息
     * @return 结果
     */
    @Override
    public int insertRecruitInfo(RecruitInfo recruitInfo)
    {
        recruitInfo.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insert(recruitInfo);
    }

    /**
     * 修改招聘信息
     * 
     * @param recruitInfo 招聘信息
     * @return 结果
     */
    @Override
    public int updateRecruitInfo(RecruitInfo recruitInfo)
    {
        recruitInfo.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateById(recruitInfo);
    }

    /**
     * 批量删除招聘信息
     * 
     * @param recruitIds 需要删除的招聘信息主键
     * @return 结果
     */
    @Override
    public int deleteRecruitInfoByRecruitIds(String recruitIds)
    {
        return baseMapper.deleteBatchIds(Arrays.asList(Convert.toLongArray(recruitIds)));
    }

    /**
     * 删除招聘信息信息
     * 
     * @param recruitId 招聘信息主键
     * @return 结果
     */
    @Override
    public int deleteRecruitInfoByRecruitId(Long recruitId)
    {
        return baseMapper.deleteById(recruitId);
    }
}
